<template>
  <div class="box-padding">
    <div class="role-title">
      选择项目
    </div>
    <Row style="padding-top:30px;">
      <Col span="16"
           offset="4">
      <Row :gutter="16">
        <Col span="20">
        <Input v-model="name"
               placeholder="请选择项目" />
        </Col>
        <Col span="4">
        <Button type="primary"
                @click="projectGetAll">搜索</Button>
        </Col>
      </Row>
      </Col>
    </Row>
    <Row style="padding-top:30px;">
      <Col span="16"
           offset="4">
      <Table :columns="columns1"
             :data="data1"
             @on-row-click="toggleTableExpand"
             ref="tableExpand">
        <template slot-scope="{ row }"
                  slot="manage">
          <span>{{row.projectManage.manageEntName}}</span>
        </template>
      </Table>
      </Col>
    </Row>
  </div>
</template>
<script>
export default {
  data() {
    return {
      msg: {
        projectName: '',
        projectId: ''
      },
      name: '',
      columns1: [
        {
          title: '项目名称',
          align: 'center',
          key: 'shortName'
        },
        {
          title: '管理单位',
          slot: 'manage',
          align: 'center'
        }
      ],
      data1: []
    }
  },
  computed: {},
  mounted() {
    this.projectGetAll()
  },
  methods: {
    projectGetAll() {
      let parmes = {
        shortName: this.name
      }
      this.$api.ProjectTeam.projectGetAll(parmes).then(resp => {
        if (resp.code == 200) {
          this.data1 = resp.data
        }
      })
    },
    toggleTableExpand(row) {
      this.msg = {
        projectName: row.shortName,
        projectId: row.id
      }
      this.$emit('func', this.msg)
    }
  }
}
</script>
<style scoped>
</style>